<template>
    <view class="df jsb ac m20">
        <view class="box-left">基本信息</view>
    </view>
    <uv-line></uv-line>
    <view class="m20">
        <uv-form :model="formData" ref="form" label-width="180rpx">
            <!-- #ifdef  H5 -->
            <view class="QRimg">
                <view class="title">点击二维码<br>查看单元详情</view>
                <a :href="formData.dcburl" class="btn">
                    <image :src="formData.QrImageBase64" mode=""></image>
                </a>
            </view>
            <!-- #endif -->

            <!-- #ifdef  APP-PLUS -->
            <view class="QRimg">
                <view>点击二维码<br>查看单元详情</view>
                <image :src="formData.QrImageBase64" mode="" @click="QRimgBtn"></image>
            </view>
            <!-- #endif -->
            <uv-form-item label="统一编号:" borderBottom>
                <uv-input v-model="formData.Tybh" border="none" readonly>
                </uv-input>
            </uv-form-item>
            <uv-form-item label="单元编号:" borderBottom>
                <uv-input v-model="formData.Dybh" border="none" readonly>
                </uv-input>
            </uv-form-item>
            <uv-form-item label="风险区名称:" borderBottom>
                <uv-input v-model="formData.Name" border="none" readonly>
                </uv-input>
            </uv-form-item>
            <uv-form-item label="地点:" borderBottom>
                <uv-input v-model="formData.Address" border="none" readonly>
                </uv-input>
            </uv-form-item>
            <uv-form-item label="风险等级:" borderBottom>
                <uv-input v-model="formData.Fxdj" border="none" readonly>
                </uv-input>
            </uv-form-item>
        </uv-form>
    </view>

</template>

<script lang="ts" setup>
import { GetXpdy_API } from '@/server/home'


onLoad((e) => {
    getList(e.code)
})
const formData = ref<any>({})
const getList = async (e) => {
    const res = await GetXpdy_API(e)
    if (res.IsSuccess) {
        formData.value = res.Data
        formData.value.Address = formData.value.District + formData.value.Town + formData.value.Village +
            "村" + formData.value.Hamlet + "组";
    }
}
const QRimgBtn = () => {
    plus.runtime.openURL(formData.value.dcburl)
}
</script>

<style lang="scss" scoped>
.QRimg {
    position: absolute;
    width: 230rpx;
    height: 230rpx;
    top: 100rpx;
    right: 20rpx;
    z-index: 99;

    .title {
        text-align: center;
        line-height: 30rpx;
        color: #007AFF;
    }

    image {
        width: 230rpx;
        height: 230rpx;
        padding: 0;
        background: #fff;
    }

}
</style>
